using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ICP_MS.Plugin.Experiment;

public class FormIsotopes : Form
{
	private ExperimentDatas experiment = null;

	private ExperimentDB db = null;

	private object currentAtomicbox = null;

	private IList<AnalyteIsotope> tempIsotopes = new List<AnalyteIsotope>();

	private IContainer components = null;

	private TableLayoutPanel tableLayoutPanel2;

	private TableLayoutPanel tableLayoutPanel5;

	private Panel panel1;

	private TreeView treeViewIons;

	private Panel panel2;

	private SplitContainer splitContainer1;

	private DataGridView dgvIsotopes;

	private DataGridView dgvAnalytes;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn8;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn9;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn10;

	private DataGridViewCheckBoxColumn colSelect;

	private DataGridViewTextBoxColumn colSymbol;

	private DataGridViewTextBoxColumn colMass;

	private DataGridViewTextBoxColumn colAbundance;

	private DataGridViewTextBoxColumn colEquation;

	private DataGridViewTextBoxColumn colInterference;

	private DataGridViewTextBoxColumn colAnlyteSymbol;

	private DataGridViewTextBoxColumn colAnlyteMass;

	private DataGridViewTextBoxColumn colAnlyteAbundance;

	private DataGridViewTextBoxColumn colAnlyteEquation;

	private DataGridViewTextBoxColumn colAnlyteInterference;

	private PeriodicTable periodicTable1;

	private Button button1;

	public FormIsotopes()
	{
		InitializeComponent();
	}

	public void SetParams(ExperimentDatas experiment, ExperimentDB db)
	{
		this.experiment = experiment;
		this.db = db;
	}

	private void FormIsotopes_Load(object sender, EventArgs e)
	{
		ApplyResources();
		Task.Factory.StartNew(InitIsotopes);
		ApplyEnable(null, null);
		experiment.applyEnable += ApplyEnable;
	}

	private void ApplyResources()
	{
		Text = Lang.Txt("FormIsotopes.Title.Text");
		colAbundance.HeaderText = Lang.Txt("FormIsotopes.Columns.Abundance.Text");
		colAnlyteAbundance.HeaderText = Lang.Txt("FormIsotopes.Columns.Abundance.Text");
		colAnlyteEquation.HeaderText = Lang.Txt("FormIsotopes.Columns.CalibrationEquation.Text");
		colAnlyteInterference.HeaderText = Lang.Txt("FormIsotopes.Columns.InterferenceTerm.Text");
		colAnlyteMass.HeaderText = Lang.Txt("FormIsotopes.Columns.Mass.Text");
		colAnlyteSymbol.HeaderText = Lang.Txt("FormIsotopes.Columns.Symbol.Text");
		colEquation.HeaderText = Lang.Txt("FormIsotopes.Columns.CalibrationEquation.Text");
		colInterference.HeaderText = Lang.Txt("FormIsotopes.Columns.InterferenceTerm.Text");
		colMass.HeaderText = Lang.Txt("FormIsotopes.Columns.Mass.Text");
		colSelect.HeaderText = Lang.Txt("FormIsotopes.Columns.Select.Text");
		colSymbol.HeaderText = Lang.Txt("FormIsotopes.Columns.Symbol.Text");
	}

	private void InitIsotopes()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Expected O, but got Unknown
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Expected O, but got Unknown
		LoadPeriodTableDatas();
		UpdatePeriod();
		periodicTable1.AtomClick += new DelegateAtomClick(periodicTable_AtomClick);
		periodicTable1.AtomDoubleClick += new DelegateAtomClick(periodicTable1_AtomDoubleClick);
		Invoke((EventHandler)delegate
		{
			treeViewIons.Nodes.Add(Lang.Txt("FormIsotopes.Nodes.PolyIons.Text"));
			treeViewIons.Nodes[0].Nodes.Add("null");
			dgvIsotopes.AutoGenerateColumns = false;
			dgvIsotopes.DataSource = tempIsotopes;
			RebindSelectIsotopes();
		});
	}

	private bool IsMassValid(float mass)
	{
		foreach (PointF pt in experiment.DisallowedRanges)
		{
			if (mass >= pt.X && mass <= pt.Y)
			{
				return false;
			}
		}
		return true;
	}

	private bool IsMassSelected(AnalyteIsotope isotope)
	{
		return experiment.SelectIsotopes.Contains(isotope);
	}

	private void LoadPeriodTableDatas()
	{
		IList<AnalyteIsotope> isotopes = db.GetAnalyteIsotopes();
		foreach (AnalyteIsotope isotope in isotopes)
		{
			if (IsMassValid((float)isotope.mass))
			{
				periodicTable1.LoadStatus(isotope.atomicSymbol, isotope.isotopeId, isotope.mass, IsMassSelected(isotope));
			}
		}
		Invoke((EventHandler)delegate
		{
			periodicTable1.CheckValid();
			((Control)(object)periodicTable1).Refresh();
		});
	}

	private void dgvIsotopes_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
	{
		if (e.ColumnIndex == 1 && e.RowIndex >= 0 && tempIsotopes[e.RowIndex].defaultSelection)
		{
			dgvIsotopes[e.ColumnIndex, e.RowIndex].Style.ForeColor = Color.Red;
		}
	}

	private void dgvIsotopes_CellValueChanged(object sender, DataGridViewCellEventArgs e)
	{
		if (e.ColumnIndex <= -1 || e.RowIndex <= -1)
		{
			return;
		}
		string name = dgvIsotopes.Columns[e.ColumnIndex].Name;
		string text = name;
		if (!(text == "colSelect"))
		{
			return;
		}
		bool select = Convert.ToBoolean(dgvIsotopes.Rows[e.RowIndex].Cells["colSelect"].Value);
		AnalyteIsotope isotope = tempIsotopes[e.RowIndex];
		if (select)
		{
			if (!experiment.SelectIsotopes.Contains(isotope) && db.AddSelectedIsotope(isotope))
			{
				experiment.SelectIsotopes.Add(isotope);
				UpdatePeriod(e.RowIndex, select: true);
				experiment.SetupIsotopeInfos();
				AddInterferenceIsotopes();
				experiment.OnIsotopeChanged();
				RebindSelectIsotopes();
			}
		}
		else if (experiment.SelectIsotopes.Contains(isotope) && db.DeleteSelectedIsotope(isotope))
		{
			experiment.SelectIsotopes.Remove(isotope);
			UpdatePeriod(e.RowIndex, select: false);
			experiment.SetupIsotopeInfos();
			AddInterferenceIsotopes();
			experiment.OnIsotopeChanged();
			RebindSelectIsotopes();
		}
	}

	private void AddInterferenceIsotopes(AnalyteIsotope selectIsotope)
	{
		if (!selectIsotope.withInterference)
		{
			return;
		}
		IList<InterferenceEquation> interferenceEquations = db.GetInterferenceEquation(selectIsotope.id);
		IsotopeInfos analyteIsotope = experiment.Isotopes.Find((IsotopeInfos isotope) => isotope.symbol == selectIsotope.symbol);
		analyteIsotope.equations = new List<InterferenceEquation>(interferenceEquations);
		foreach (InterferenceEquation interferenceEquation in interferenceEquations)
		{
			if (!experiment.Isotopes.Exists((IsotopeInfos isotope) => isotope.symbol == interferenceEquation.interferenceSymbol))
			{
				AnalyteIsotope interferenceIsotope = db.GetAnalyteIsotopeById(interferenceEquation.interferenceId);
				experiment.Isotopes.Add(new IsotopeInfos
				{
					id = interferenceIsotope.id,
					symbol = interferenceIsotope.symbol,
					mass = interferenceIsotope.mass,
					name = "Default",
					units = "ng/mL",
					visible = true,
					technique = Lang.Txt("AddFormIsotopes.None"),
					force = 0,
					withInterference = interferenceIsotope.withInterference,
					isInterference = true
				});
				AddInterferenceIsotopes(interferenceIsotope);
			}
		}
	}

	private void AddInterferenceIsotopes()
	{
		experiment.SelectIsotopes.ForEach(delegate(AnalyteIsotope selectIsotope)
		{
			AddInterferenceIsotopes(selectIsotope);
		});
	}

	private void dgvIsotopes_CurrentCellDirtyStateChanged(object sender, EventArgs e)
	{
		if (dgvIsotopes.IsCurrentCellDirty)
		{
			dgvIsotopes.CommitEdit(DataGridViewDataErrorContexts.Commit);
		}
	}

	private void UpdatePeriod(int index, bool select)
	{
		if (currentAtomicbox == null)
		{
			return;
		}
		object obj = currentAtomicbox;
		IsotopeBox isotopeBox = (IsotopeBox)((obj is IsotopeBox) ? obj : null);
		try
		{
			if (select)
			{
				isotopeBox.Status.SelectStatus[index].Status = 1;
			}
			else
			{
				isotopeBox.Status.SelectStatus[index].Status = 2;
			}
		}
		catch
		{
		}
		((Control)(object)isotopeBox).Refresh();
	}

	private void UpdatePeriod()
	{
		foreach (AnalyteIsotope isotope in experiment.SelectIsotopes)
		{
			periodicTable1.SetSelect(isotope.atomicSymbol, isotope.isotopeId, true);
		}
	}

	private void UpdatePeriod(List<AnalyteIsotope> isotopes)
	{
		foreach (AnalyteIsotope isotope in isotopes)
		{
			periodicTable1.SetSelect(isotope.atomicSymbol, isotope.isotopeId, false);
		}
	}

	private bool SetPeriodStatus(string atom, bool inter)
	{
		return false;
	}

	private void AddIsotope2Dgw(string atom, bool useDefault = false)
	{
		Cursor = Cursors.WaitCursor;
		IList<AnalyteIsotope> isotopes = db.GetAnalyteIsotopesByAtomic(atom);
		if (isotopes != null)
		{
			tempIsotopes.Clear();
			foreach (AnalyteIsotope isotope in isotopes)
			{
				if (IsMassValid((float)isotope.mass))
				{
					tempIsotopes.Add(isotope);
				}
			}
			RebindPeriodIsotopes();
			SetTempIsotopeChecked();
		}
		if (useDefault)
		{
			for (int i = 0; i < tempIsotopes.Count; i++)
			{
				if (tempIsotopes[i].defaultSelection)
				{
					dgvIsotopes[0, i].Value = true;
					break;
				}
			}
		}
		Cursor = Cursors.Arrow;
	}

	private void SetTempIsotopeChecked()
	{
		dgvIsotopes.CellValueChanged -= dgvIsotopes_CellValueChanged;
		for (int i = 0; i < tempIsotopes.Count; i++)
		{
			if (experiment.SelectIsotopes.Contains(tempIsotopes[i]))
			{
				dgvIsotopes[0, i].Value = true;
			}
			else
			{
				dgvIsotopes[0, i].Value = false;
			}
		}
		dgvIsotopes.CellValueChanged += dgvIsotopes_CellValueChanged;
	}

	private string GetEquations(int peakId)
	{
		string equation = "";
		IList<InterferenceEquation> interferences = db.GetInterferenceEquation(peakId);
		foreach (InterferenceEquation interference in interferences)
		{
			double factor = interference.interferenceFactor;
			string symbol = db.GetSymbolById(interference.interferenceId);
			equation = equation + ((factor >= 0.0) ? "+" : "-") + factor.ToString("F5") + " * " + symbol;
		}
		return equation;
	}

	private void RebindPeriodIsotopes()
	{
		BindingContext[dgvIsotopes.DataSource].SuspendBinding();
		dgvIsotopes.DataSource = null;
		dgvIsotopes.DataSource = tempIsotopes;
		BindingContext[dgvIsotopes.DataSource].ResumeBinding();
		for (int i = 0; i < dgvIsotopes.Rows.Count; i++)
		{
			dgvIsotopes.Rows[i].HeaderCell.Value = (i + 1).ToString();
		}
	}

	private void RebindSelectIsotopes()
	{
		dgvAnalytes.AutoGenerateColumns = false;
		experiment.SelectIsotopes.Sort((AnalyteIsotope s1, AnalyteIsotope s2) => s1.mass.CompareTo(s2.mass));
		if (dgvAnalytes.DataSource == null)
		{
			dgvAnalytes.DataSource = experiment.SelectIsotopes;
		}
		else
		{
			BindingContext[dgvAnalytes.DataSource].SuspendBinding();
			dgvAnalytes.DataSource = null;
			dgvAnalytes.DataSource = experiment.SelectIsotopes;
			BindingContext[dgvAnalytes.DataSource].ResumeBinding();
		}
		for (int i = 0; i < dgvAnalytes.Rows.Count; i++)
		{
			dgvAnalytes.Rows[i].HeaderCell.Value = (i + 1).ToString();
		}
	}

	private void periodicTable_AtomClick(object sender, AtomEventArgs e)
	{
		currentAtomicbox = sender;
		AddIsotope2Dgw(e.Atomic);
	}

	private void periodicTable1_AtomDoubleClick(object sender, AtomEventArgs e)
	{
		currentAtomicbox = sender;
		AddIsotope2Dgw(e.Atomic, useDefault: true);
	}

	private void treeViewIons_BeforeExpand(object sender, TreeViewCancelEventArgs e)
	{
		if (treeViewIons.Nodes[0].Nodes.Count != 1 || !(treeViewIons.Nodes[0].Nodes[0].Text == "null"))
		{
			return;
		}
		IList<AnalyteIsotope> ions = db.GetPolyIonsIn();
		if (ions == null)
		{
			return;
		}
		IEnumerable<string> syms = ions.Select((AnalyteIsotope ion) => ion.atomicSymbol).Distinct();
		foreach (string sym in syms)
		{
			treeViewIons.Nodes[0].Nodes.Add(sym);
		}
	}

	private void treeViewIons_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
	{
		if (e.Node.Text != "null" && treeViewIons.Nodes[0].Nodes.Contains(e.Node))
		{
			currentAtomicbox = null;
			AddIsotope2Dgw(e.Node.Text);
		}
	}

	public void ApplyEnable(object sender, EventArgs e)
	{
		if (experiment.Scan.currentStatus != 0)
		{
			dgvIsotopes.DataSource = null;
			dgvIsotopes.ReadOnly = true;
			dgvAnalytes.RowHeadersVisible = false;
			((Control)(object)periodicTable1).Enabled = false;
		}
	}

	private void dgvAnalytes_KeyDown(object sender, KeyEventArgs e)
	{
		if (dgvAnalytes.SelectedRows != null && dgvAnalytes.SelectedRows.Count > 0 && e.KeyCode == Keys.Delete)
		{
			DeleteSelectedIsotopes();
		}
	}

	private void dgvAnalytes_MouseDown(object sender, MouseEventArgs e)
	{
		if (dgvAnalytes.SelectedRows != null && dgvAnalytes.SelectedRows.Count > 0 && e.Button == MouseButtons.Right)
		{
			ContextMenu menu = new ContextMenu();
			menu.MenuItems.Add(Lang.Txt("FormIsotopes.Menu.Delete.Text"), delegate
			{
				DeleteSelectedIsotopes();
			});
			menu.Show(dgvAnalytes, e.Location);
		}
	}

	private void DeleteSelectedIsotopes()
	{
		List<AnalyteIsotope> isotopes = new List<AnalyteIsotope>();
		foreach (DataGridViewRow row in dgvAnalytes.SelectedRows)
		{
			isotopes.Add(experiment.SelectIsotopes[row.Index]);
		}
		foreach (AnalyteIsotope isotope in isotopes)
		{
			if (db.DeleteSelectedIsotope(isotope))
			{
				experiment.SelectIsotopes.Remove(isotope);
			}
		}
		RebindSelectIsotopes();
		SetTempIsotopeChecked();
		UpdatePeriod(isotopes);
		experiment.SetupIsotopeInfos();
		experiment.OnIsotopeChanged();
	}

	private void FormIsotopes_FormClosing(object sender, FormClosingEventArgs e)
	{
		experiment.applyEnable -= ApplyEnable;
	}

	private void dgvIsotopes_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
	{
		if (e.ColumnIndex < 0 || e.RowIndex < 0)
		{
			return;
		}
		string name = dgvIsotopes.Columns[e.ColumnIndex].Name;
		string text = name;
		if (!(text == "colEquation"))
		{
			if (text == "colInterference")
			{
				FormInterfere formInterfere = new FormInterfere(dgvIsotopes[e.ColumnIndex, e.RowIndex].Value.ToString());
				formInterfere.ShowDialog();
			}
			return;
		}
		AnalyteIsotope isotope = tempIsotopes[e.RowIndex];
		FormEquation form = new FormEquation(db, isotope);
		if (form.ShowDialog() == DialogResult.OK)
		{
			db.SaveAnalyteIsotope(isotope);
			dgvIsotopes.Refresh();
			IList<InterferenceEquation> interferences = db.GetInterferenceEquation(isotope.id);
			AnalyteIsotope isotopeinfo = experiment.SelectIsotopes.Find((AnalyteIsotope r) => r.mass == isotope.mass && r.symbol == isotope.symbol);
			if (isotopeinfo != null)
			{
				experiment.SelectIsotopes.Remove(isotopeinfo);
				experiment.SelectIsotopes.Add(isotope);
				experiment.SetupIsotopeInfos();
				AddInterferenceIsotopes();
				RebindSelectIsotopes();
				dgvAnalytes.Refresh();
			}
		}
	}

	private void dgvAnalytes_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
	{
		if (e.ColumnIndex >= 0 && e.RowIndex >= 0 && dgvAnalytes.Columns[e.ColumnIndex].Name == "colAnlyteInterference")
		{
			FormInterfere formInterfere = new FormInterfere(dgvAnalytes[e.ColumnIndex, e.RowIndex].Value.ToString());
			formInterfere.ShowDialog();
		}
		if (e.ColumnIndex < 0 || e.RowIndex < 0 || !(dgvAnalytes.Columns[e.ColumnIndex].Name == "colAnlyteEquation"))
		{
			return;
		}
		AnalyteIsotope isotope = experiment.SelectIsotopes[e.RowIndex];
		FormEquation form = new FormEquation(db, isotope);
		if (form.ShowDialog() == DialogResult.OK)
		{
			db.SaveAnalyteIsotope(isotope);
			dgvIsotopes.Refresh();
			IList<InterferenceEquation> interferences = db.GetInterferenceEquation(isotope.id);
			AnalyteIsotope isotopeinfo = experiment.SelectIsotopes.Find((AnalyteIsotope r) => r.mass == isotope.mass && r.symbol == isotope.symbol);
			if (isotopeinfo != null)
			{
				experiment.SelectIsotopes.Remove(isotopeinfo);
				experiment.SelectIsotopes.Add(isotope);
				experiment.SetupIsotopeInfos();
				experiment.OnIsotopeChanged();
				AddInterferenceIsotopes();
				RebindSelectIsotopes();
				dgvAnalytes.Refresh();
			}
		}
	}

	private void button1_Click(object sender, EventArgs e)
	{
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
		this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
		this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel();
		this.panel1 = new System.Windows.Forms.Panel();
		this.button1 = new System.Windows.Forms.Button();
		this.periodicTable1 = new PeriodicTable();
		this.treeViewIons = new System.Windows.Forms.TreeView();
		this.panel2 = new System.Windows.Forms.Panel();
		this.splitContainer1 = new System.Windows.Forms.SplitContainer();
		this.dgvIsotopes = new System.Windows.Forms.DataGridView();
		this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn();
		this.colSymbol = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.colMass = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.colAbundance = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.colEquation = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.colInterference = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dgvAnalytes = new System.Windows.Forms.DataGridView();
		this.colAnlyteSymbol = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.colAnlyteMass = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.colAnlyteAbundance = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.colAnlyteEquation = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.colAnlyteInterference = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.dataGridViewTextBoxColumn10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.tableLayoutPanel2.SuspendLayout();
		this.tableLayoutPanel5.SuspendLayout();
		this.panel1.SuspendLayout();
		this.panel2.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.splitContainer1).BeginInit();
		this.splitContainer1.Panel1.SuspendLayout();
		this.splitContainer1.Panel2.SuspendLayout();
		this.splitContainer1.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.dgvIsotopes).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.dgvAnalytes).BeginInit();
		base.SuspendLayout();
		this.tableLayoutPanel2.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.OutsetPartial;
		this.tableLayoutPanel2.ColumnCount = 2;
		this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 252f));
		this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100f));
		this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel5, 0, 1);
		this.tableLayoutPanel2.Controls.Add(this.treeViewIons, 0, 0);
		this.tableLayoutPanel2.Controls.Add(this.panel2, 1, 0);
		this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
		this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0);
		this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(4);
		this.tableLayoutPanel2.Name = "tableLayoutPanel2";
		this.tableLayoutPanel2.RowCount = 2;
		this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100f));
		this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 312f));
		this.tableLayoutPanel2.Size = new System.Drawing.Size(1067, 599);
		this.tableLayoutPanel2.TabIndex = 2;
		this.tableLayoutPanel5.ColumnCount = 3;
		this.tableLayoutPanel2.SetColumnSpan(this.tableLayoutPanel5, 2);
		this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50f));
		this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 960f));
		this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50f));
		this.tableLayoutPanel5.Controls.Add(this.panel1, 1, 0);
		this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill;
		this.tableLayoutPanel5.Location = new System.Drawing.Point(7, 288);
		this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(4);
		this.tableLayoutPanel5.Name = "tableLayoutPanel5";
		this.tableLayoutPanel5.RowCount = 1;
		this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100f));
		this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 304f));
		this.tableLayoutPanel5.Size = new System.Drawing.Size(1053, 304);
		this.tableLayoutPanel5.TabIndex = 100;
		this.panel1.Controls.Add(this.button1);
		this.panel1.Controls.Add((System.Windows.Forms.Control)(object)this.periodicTable1);
		this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
		this.panel1.Location = new System.Drawing.Point(50, 4);
		this.panel1.Margin = new System.Windows.Forms.Padding(4);
		this.panel1.Name = "panel1";
		this.panel1.Size = new System.Drawing.Size(952, 296);
		this.panel1.TabIndex = 1;
		this.button1.ForeColor = System.Drawing.SystemColors.ControlText;
		this.button1.Location = new System.Drawing.Point(367, 31);
		this.button1.Name = "button1";
		this.button1.Size = new System.Drawing.Size(127, 33);
		this.button1.TabIndex = 1;
		this.button1.Text = "转到质量轴";
		this.button1.UseVisualStyleBackColor = true;
		this.button1.Visible = false;
		((System.Windows.Forms.Control)(object)this.periodicTable1).Location = new System.Drawing.Point(4, 4);
		((System.Windows.Forms.Control)(object)this.periodicTable1).Margin = new System.Windows.Forms.Padding(5);
		((System.Windows.Forms.Control)(object)this.periodicTable1).Name = "periodicTable1";
		((System.Windows.Forms.Control)(object)this.periodicTable1).Size = new System.Drawing.Size(960, 292);
		((System.Windows.Forms.Control)(object)this.periodicTable1).TabIndex = 0;
		this.treeViewIons.Dock = System.Windows.Forms.DockStyle.Fill;
		this.treeViewIons.Location = new System.Drawing.Point(7, 7);
		this.treeViewIons.Margin = new System.Windows.Forms.Padding(4);
		this.treeViewIons.Name = "treeViewIons";
		this.treeViewIons.Size = new System.Drawing.Size(244, 270);
		this.treeViewIons.TabIndex = 1;
		this.treeViewIons.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(treeViewIons_BeforeExpand);
		this.treeViewIons.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(treeViewIons_NodeMouseClick);
		this.panel2.Controls.Add(this.splitContainer1);
		this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
		this.panel2.Location = new System.Drawing.Point(262, 7);
		this.panel2.Margin = new System.Windows.Forms.Padding(4);
		this.panel2.Name = "panel2";
		this.panel2.Size = new System.Drawing.Size(798, 270);
		this.panel2.TabIndex = 101;
		this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
		this.splitContainer1.Location = new System.Drawing.Point(0, 0);
		this.splitContainer1.Margin = new System.Windows.Forms.Padding(4);
		this.splitContainer1.Name = "splitContainer1";
		this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
		this.splitContainer1.Panel1.Controls.Add(this.dgvIsotopes);
		this.splitContainer1.Panel2.Controls.Add(this.dgvAnalytes);
		this.splitContainer1.Size = new System.Drawing.Size(798, 270);
		this.splitContainer1.SplitterDistance = 139;
		this.splitContainer1.SplitterWidth = 5;
		this.splitContainer1.TabIndex = 0;
		this.dgvIsotopes.AllowUserToAddRows = false;
		this.dgvIsotopes.AllowUserToDeleteRows = false;
		this.dgvIsotopes.AllowUserToResizeRows = false;
		this.dgvIsotopes.BackgroundColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
		dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
		this.dgvIsotopes.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
		this.dgvIsotopes.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
		this.dgvIsotopes.Columns.AddRange(this.colSelect, this.colSymbol, this.colMass, this.colAbundance, this.colEquation, this.colInterference);
		dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Window;
		dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.ControlText;
		dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
		this.dgvIsotopes.DefaultCellStyle = dataGridViewCellStyle6;
		this.dgvIsotopes.Dock = System.Windows.Forms.DockStyle.Fill;
		this.dgvIsotopes.Location = new System.Drawing.Point(0, 0);
		this.dgvIsotopes.Margin = new System.Windows.Forms.Padding(4);
		this.dgvIsotopes.MultiSelect = false;
		this.dgvIsotopes.Name = "dgvIsotopes";
		this.dgvIsotopes.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
		this.dgvIsotopes.RowTemplate.Height = 23;
		this.dgvIsotopes.Size = new System.Drawing.Size(798, 139);
		this.dgvIsotopes.TabIndex = 2;
		this.dgvIsotopes.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(dgvIsotopes_CellDoubleClick);
		this.dgvIsotopes.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(dgvIsotopes_CellFormatting);
		this.dgvIsotopes.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(dgvIsotopes_CellValueChanged);
		this.dgvIsotopes.CurrentCellDirtyStateChanged += new System.EventHandler(dgvIsotopes_CurrentCellDirtyStateChanged);
		this.colSelect.FillWeight = 20f;
		this.colSelect.HeaderText = "选择";
		this.colSelect.MinimumWidth = 6;
		this.colSelect.Name = "colSelect";
		this.colSelect.Resizable = System.Windows.Forms.DataGridViewTriState.True;
		this.colSelect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
		this.colSelect.Width = 60;
		this.colSymbol.DataPropertyName = "symbol";
		this.colSymbol.FillWeight = 20f;
		this.colSymbol.HeaderText = "符号";
		this.colSymbol.MinimumWidth = 6;
		this.colSymbol.Name = "colSymbol";
		this.colSymbol.ReadOnly = true;
		this.colSymbol.Width = 80;
		this.colMass.DataPropertyName = "mass";
		this.colMass.FillWeight = 20f;
		this.colMass.HeaderText = "质量数";
		this.colMass.MinimumWidth = 6;
		this.colMass.Name = "colMass";
		this.colMass.ReadOnly = true;
		this.colMass.Width = 130;
		this.colAbundance.DataPropertyName = "abundance";
		this.colAbundance.FillWeight = 20f;
		this.colAbundance.HeaderText = "丰度";
		this.colAbundance.MinimumWidth = 6;
		this.colAbundance.Name = "colAbundance";
		this.colAbundance.ReadOnly = true;
		this.colAbundance.Width = 130;
		this.colEquation.DataPropertyName = "equation";
		this.colEquation.FillWeight = 20f;
		this.colEquation.HeaderText = "校正方程";
		this.colEquation.MinimumWidth = 6;
		this.colEquation.Name = "colEquation";
		this.colEquation.ReadOnly = true;
		this.colEquation.Width = 125;
		this.colInterference.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.colInterference.DataPropertyName = "interferences";
		this.colInterference.HeaderText = "干扰项";
		this.colInterference.MinimumWidth = 6;
		this.colInterference.Name = "colInterference";
		this.colInterference.ReadOnly = true;
		this.dgvAnalytes.AllowUserToAddRows = false;
		this.dgvAnalytes.AllowUserToDeleteRows = false;
		this.dgvAnalytes.AllowUserToResizeRows = false;
		this.dgvAnalytes.BackgroundColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText;
		dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
		this.dgvAnalytes.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
		this.dgvAnalytes.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
		this.dgvAnalytes.Columns.AddRange(this.colAnlyteSymbol, this.colAnlyteMass, this.colAnlyteAbundance, this.colAnlyteEquation, this.colAnlyteInterference);
		dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Window;
		dataGridViewCellStyle8.Font = new System.Drawing.Font("Microsoft Sans Serif", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.ControlText;
		dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
		this.dgvAnalytes.DefaultCellStyle = dataGridViewCellStyle8;
		this.dgvAnalytes.Dock = System.Windows.Forms.DockStyle.Fill;
		this.dgvAnalytes.Location = new System.Drawing.Point(0, 0);
		this.dgvAnalytes.Margin = new System.Windows.Forms.Padding(4);
		this.dgvAnalytes.Name = "dgvAnalytes";
		this.dgvAnalytes.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
		this.dgvAnalytes.RowTemplate.Height = 23;
		this.dgvAnalytes.Size = new System.Drawing.Size(798, 126);
		this.dgvAnalytes.TabIndex = 3;
		this.dgvAnalytes.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(dgvAnalytes_CellDoubleClick);
		this.dgvAnalytes.KeyDown += new System.Windows.Forms.KeyEventHandler(dgvAnalytes_KeyDown);
		this.dgvAnalytes.MouseDown += new System.Windows.Forms.MouseEventHandler(dgvAnalytes_MouseDown);
		this.colAnlyteSymbol.DataPropertyName = "symbol";
		this.colAnlyteSymbol.FillWeight = 20f;
		this.colAnlyteSymbol.HeaderText = "符号";
		this.colAnlyteSymbol.MinimumWidth = 6;
		this.colAnlyteSymbol.Name = "colAnlyteSymbol";
		this.colAnlyteSymbol.ReadOnly = true;
		this.colAnlyteSymbol.Width = 80;
		this.colAnlyteMass.DataPropertyName = "mass";
		this.colAnlyteMass.FillWeight = 20f;
		this.colAnlyteMass.HeaderText = "质量数";
		this.colAnlyteMass.MinimumWidth = 6;
		this.colAnlyteMass.Name = "colAnlyteMass";
		this.colAnlyteMass.ReadOnly = true;
		this.colAnlyteMass.Width = 130;
		this.colAnlyteAbundance.DataPropertyName = "abundance";
		this.colAnlyteAbundance.FillWeight = 20f;
		this.colAnlyteAbundance.HeaderText = "丰度";
		this.colAnlyteAbundance.MinimumWidth = 6;
		this.colAnlyteAbundance.Name = "colAnlyteAbundance";
		this.colAnlyteAbundance.ReadOnly = true;
		this.colAnlyteAbundance.Width = 130;
		this.colAnlyteEquation.DataPropertyName = "equation";
		this.colAnlyteEquation.FillWeight = 20f;
		this.colAnlyteEquation.HeaderText = "校正方程";
		this.colAnlyteEquation.MinimumWidth = 6;
		this.colAnlyteEquation.Name = "colAnlyteEquation";
		this.colAnlyteEquation.ReadOnly = true;
		this.colAnlyteEquation.Width = 125;
		this.colAnlyteInterference.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.colAnlyteInterference.DataPropertyName = "interferences";
		this.colAnlyteInterference.HeaderText = "干扰项";
		this.colAnlyteInterference.MinimumWidth = 6;
		this.colAnlyteInterference.Name = "colAnlyteInterference";
		this.colAnlyteInterference.ReadOnly = true;
		this.dataGridViewTextBoxColumn1.DataPropertyName = "symbol";
		this.dataGridViewTextBoxColumn1.FillWeight = 20f;
		this.dataGridViewTextBoxColumn1.HeaderText = "符号";
		this.dataGridViewTextBoxColumn1.MinimumWidth = 6;
		this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
		this.dataGridViewTextBoxColumn1.ReadOnly = true;
		this.dataGridViewTextBoxColumn1.Width = 80;
		this.dataGridViewTextBoxColumn2.DataPropertyName = "mass";
		this.dataGridViewTextBoxColumn2.FillWeight = 20f;
		this.dataGridViewTextBoxColumn2.HeaderText = "质量数";
		this.dataGridViewTextBoxColumn2.MinimumWidth = 6;
		this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
		this.dataGridViewTextBoxColumn2.ReadOnly = true;
		this.dataGridViewTextBoxColumn2.Width = 80;
		this.dataGridViewTextBoxColumn3.DataPropertyName = "abundance";
		this.dataGridViewTextBoxColumn3.FillWeight = 20f;
		this.dataGridViewTextBoxColumn3.HeaderText = "丰度";
		this.dataGridViewTextBoxColumn3.MinimumWidth = 6;
		this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
		this.dataGridViewTextBoxColumn3.ReadOnly = true;
		this.dataGridViewTextBoxColumn3.Width = 60;
		this.dataGridViewTextBoxColumn4.DataPropertyName = "equation";
		this.dataGridViewTextBoxColumn4.FillWeight = 20f;
		this.dataGridViewTextBoxColumn4.HeaderText = "校正方程";
		this.dataGridViewTextBoxColumn4.MinimumWidth = 6;
		this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
		this.dataGridViewTextBoxColumn4.ReadOnly = true;
		this.dataGridViewTextBoxColumn4.Width = 125;
		this.dataGridViewTextBoxColumn5.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.dataGridViewTextBoxColumn5.DataPropertyName = "interferences";
		this.dataGridViewTextBoxColumn5.HeaderText = "干扰项";
		this.dataGridViewTextBoxColumn5.MinimumWidth = 6;
		this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
		this.dataGridViewTextBoxColumn5.ReadOnly = true;
		this.dataGridViewTextBoxColumn6.DataPropertyName = "symbol";
		this.dataGridViewTextBoxColumn6.FillWeight = 20f;
		this.dataGridViewTextBoxColumn6.HeaderText = "符号";
		this.dataGridViewTextBoxColumn6.MinimumWidth = 6;
		this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
		this.dataGridViewTextBoxColumn6.ReadOnly = true;
		this.dataGridViewTextBoxColumn6.Width = 80;
		this.dataGridViewTextBoxColumn7.DataPropertyName = "mass";
		this.dataGridViewTextBoxColumn7.FillWeight = 20f;
		this.dataGridViewTextBoxColumn7.HeaderText = "质量数";
		this.dataGridViewTextBoxColumn7.MinimumWidth = 6;
		this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
		this.dataGridViewTextBoxColumn7.ReadOnly = true;
		this.dataGridViewTextBoxColumn7.Width = 80;
		this.dataGridViewTextBoxColumn8.DataPropertyName = "abundance";
		this.dataGridViewTextBoxColumn8.FillWeight = 20f;
		this.dataGridViewTextBoxColumn8.HeaderText = "丰度";
		this.dataGridViewTextBoxColumn8.MinimumWidth = 6;
		this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8";
		this.dataGridViewTextBoxColumn8.ReadOnly = true;
		this.dataGridViewTextBoxColumn8.Width = 60;
		this.dataGridViewTextBoxColumn9.DataPropertyName = "equation";
		this.dataGridViewTextBoxColumn9.FillWeight = 20f;
		this.dataGridViewTextBoxColumn9.HeaderText = "校正方程";
		this.dataGridViewTextBoxColumn9.MinimumWidth = 6;
		this.dataGridViewTextBoxColumn9.Name = "dataGridViewTextBoxColumn9";
		this.dataGridViewTextBoxColumn9.ReadOnly = true;
		this.dataGridViewTextBoxColumn9.Width = 125;
		this.dataGridViewTextBoxColumn10.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
		this.dataGridViewTextBoxColumn10.DataPropertyName = "interferences";
		this.dataGridViewTextBoxColumn10.HeaderText = "干扰项";
		this.dataGridViewTextBoxColumn10.MinimumWidth = 6;
		this.dataGridViewTextBoxColumn10.Name = "dataGridViewTextBoxColumn10";
		this.dataGridViewTextBoxColumn10.ReadOnly = true;
		base.AutoScaleDimensions = new System.Drawing.SizeF(8f, 15f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(1067, 599);
		base.Controls.Add(this.tableLayoutPanel2);
		base.Margin = new System.Windows.Forms.Padding(4);
		base.Name = "FormIsotopes";
		base.ShowIcon = false;
		this.Text = "FormIsotopes";
		base.FormClosing += new System.Windows.Forms.FormClosingEventHandler(FormIsotopes_FormClosing);
		base.Load += new System.EventHandler(FormIsotopes_Load);
		this.tableLayoutPanel2.ResumeLayout(false);
		this.tableLayoutPanel5.ResumeLayout(false);
		this.panel1.ResumeLayout(false);
		this.panel2.ResumeLayout(false);
		this.splitContainer1.Panel1.ResumeLayout(false);
		this.splitContainer1.Panel2.ResumeLayout(false);
		((System.ComponentModel.ISupportInitialize)this.splitContainer1).EndInit();
		this.splitContainer1.ResumeLayout(false);
		((System.ComponentModel.ISupportInitialize)this.dgvIsotopes).EndInit();
		((System.ComponentModel.ISupportInitialize)this.dgvAnalytes).EndInit();
		base.ResumeLayout(false);
	}
}
